package com.foreknow.elmboot.service;

import com.foreknow.elmboot.po.DeliveryAddress;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface DeliveryAddressService {
    /**
     * 读取用户地址
     * @param userId 用户ID
     * @return 用户地址集合
     */
    public List<DeliveryAddress> readAddress(Integer userId) throws Exception;

    /**
     * 根据地址Id查询地址
     * @param daId
     * @return
     * @throws Exception
     */
    public DeliveryAddress getDeliveryAddressById(Integer daId) throws Exception;

    /**
     * 更新地址信息
     * @param daId
     * @param contactName
     * @param contactSex
     * @param contactTel
     * @param address
     * @param userId
     * @return
     */
    public int reviseDeliveryAddress(Integer daId,
                                     String contactName,
                                     Integer contactSex,
                                     String contactTel,
                                     String address,
                                     Integer userId) throws Exception;

    /**
     * 删除对应地址
     * @param daId
     * @return
     * @throws Exception
     */
    public int deleteDeliveryAddress(Integer daId) throws Exception;

    /**
     * 新增对应地址
     * @param contactName
     * @param contactSex
     * @param contactTel
     * @param address
     * @param userId
     * @return
     * @throws Exception
     */
    public int saveDeliveryAddress(String contactName,
                                   Integer contactSex,
                                   String contactTel,
                                   String address,
                                   Integer userId) throws Exception;
}
